All files / helperComponents abstractRepresentation.vue

60.71% Statements 17/28
75% Branches 9/12
0% Functions 0/4
60.71% Lines 17/28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77          58x           54x 54x     54x 18x 18x 9x   18x 2x     54x     54x     54x                                                         1x 1x                 1x 1x 1x          
<script>
export default {
  data() {},
  methods: {
    inTransit(file) {
      return file.inTransit;
    },
    selectAllFiles() {
      this.$store.commit("markAllFilesSelected");
    },
    fileClass(file) {
      let htmlClasses = "scoped-file-icon ";
I      if (this.inDeletion(file)) {
        htmlClasses += "file-in-deletion ";
      }
      if (this.inTransit(file) === true ) {
        htmlClasses += "file-in-transit ";
        if (this.$store.state.transitType == "move") {
          htmlClasses += "move ";
        }
        if (this.$store.state.transitType == "copy") {
          htmlClasses += "copy ";
        }
      }
I      if (file.selected) {
        htmlClasses += "selected ";
      }
      return htmlClasses;
    },
    inDeletion(file) {
      return this.fileInDeletion == file.path;
    },
    deleteFile(file) {
      this.$dialog
        .confirm(
          this.translate("You are sure you want to delete %s").replace(
            "%s",
            file.shortName
          )
        )
        .then(dialog => {
          this.loadingState = true;
          this.$store
            .dispatch("deleteFile", file)
            .then(
              result => {},
              error => {
                this.$log.error(error);
              }
            )
            .finally(() => {
              this.loadingState = false;
            });
        })
        .catch(() => {
          this.$.log.log("Clicked on cancel");
        });
    },
    copyFile(file) {
      this.$store.commit("copyFiles");
      this.$set(file, 'inTransit', true);
      //file.inTransit = true;
    },
    moveFile(file) {
      this.$store.commit("moveFiles");
      this.$set(file, 'inTransit', true);
      //file.inTransit = true;
    },
    cancelTransit(file) {
      this.$set(file, 'inTransit', false);
E      if( this.$store.getters.filesInTransit.length == 0 ) {
        this.$store.commit('noTransit');
      }
    }
  }
};
</script>